package com.yds.longlinks.client;

import android.content.Context;

/**
 * 作者:     YDS
 * 创建时间: 2022/11/28 21:06
 * 页面描述:
 */
public class MinaClientConnectionConfig {

    private Context context;
    private String ip;
    private int port;
    private int readBufferSize;
    private long connectionTimeout;

    public Context getContext() {
        return context;
    }

    public String getIp() {
        return ip;
    }

    public int getPort() {
        return port;
    }

    public int getReadBufferSize() {
        return readBufferSize;
    }

    public long getConnectionTimeout() {
        return connectionTimeout;
    }

    public static class Builder {

        private Context context;
        private String ip = "192.168.42.149";
        private int port = 8686;
        private int readBufferSize = 1024 * 10;
        private long connectionTimeout = 1000 * 10;

        public Builder(Context context) {
            this.context = context;
        }

        public Builder setIp(String ip) {
            this.ip = ip;
            return this;
        }

        public Builder setPort(int port) {
            this.port = port;
            return this;
        }

        public Builder setReadBufferSize(int readBufferSize) {
            this.readBufferSize = readBufferSize;
            return this;
        }

        public Builder setConnectionTimeout(long connectionTimeout) {
            this.connectionTimeout = connectionTimeout;
            return this;
        }

        public MinaClientConnectionConfig build() {
            MinaClientConnectionConfig config = new MinaClientConnectionConfig();
            config.context = this.context;
            config.ip = this.ip;
            config.port = this.port;
            config.readBufferSize = this.readBufferSize;
            config.connectionTimeout = this.connectionTimeout;

            return config;
        }
    }
}
